package cn.pisoft.axis;

import java.rmi.RemoteException;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;


public class CallString {
	public static void main(String[] args) {
		try {
			String url = "http://10.111.43.22:9734/ERP/erp_ws_test";
			Service service = new Service();
			Call call = (Call) service.createCall();
			call.setTargetEndpointAddress(url);
			call.setOperationName(new QName(url, "exec"));
//			 call.addParameter(new QName("http://www.tbi.ydtf.com/",
//			 "units"),XMLType.SOAP_STRING,ParameterMode.IN);
//			call.setReturnType(new QName("http://www.tbi.ydtf.com/",
//			"response"), Xljg[].class);

//			// 注册映射关系
//			QName XljgInfo = new QName("http://www.tbi.ydtf.com/", "xljg");
//			call.registerTypeMapping(Xljg.class, XljgInfo,
//					new BeanSerializerFactory(Xljg.class, XljgInfo),
//					new BeanDeserializerFactory(Xljg.class, XljgInfo));

//			Xljg[] xljg = (Xljg[]) call.invoke(new Object[] {"昆明"});
			String result = (String)call.invoke(new Object[]{"CN=陈雪/OU=信息软件所/O=电力研究院"});
			
			System.out.println(result);
//			for(Xljg xl : xljg){
//				System.out.println(xl.getQualifications()+": "+xl.getCount());
//			}
		} catch (ServiceException e) {
			e.printStackTrace();
		} catch (RemoteException e) {
			e.printStackTrace();
		}
	}
}
